package experiment2;

import java.util.Scanner;

public class No3 {
    public static void main(String []args)
    {
        Scanner input=new Scanner(System.in);
        System.out.println("请输入年：");
        int year=input.nextInt();
        System.out.println("请输入月份：");
        int month=input.nextInt();

        No3 k=new No3();
        System.out.println(k.month_trans(month)+" "+year+" has "+k.days(year,month)+" days");


    }


    public int days(int year,int month) //返回这个月有几天
    {
        boolean r_y = runyear(year);
        switch (month) {
            case 1:
                return 31;
            case 2:
                if (r_y) {
                    return 29;
                } else {
                    return 28;
                }
            case 3:
                return 31;
            case 4:
                return 30;
            case 5:
                return 31;
            case 6:
                return 30;
            case 7:
                return 31;
            case 8:
                return 31;
            case 9:
                return 30;
            case 10:
                return 31;
            case 11:
                return 30;
            case 12:
                return 31;
            default:
                return 0;
        }
    }


    public String month_trans(int month)//将月份转换成英文
    {
        switch (month)
        {
            case 1:return ("January"); 
            case 2:return ("February"); 
            case 3:return ("March"); 
            case 4:return ("April"); 
            case 5:return ("May"); 
            case 6:return ("June"); 
            case 7:return ("July"); 
            case 8:return ("August"); 
            case 9:return ("September"); 
            case 10:return ("October"); 
            case 11:return ("November"); 
            case 12:return ("December"); 
            default:return "";
        }
    }
    public boolean runyear(int year)//判断是否是闰年
    {
        if ((year%4==0&&year%100!=0)||year%400!=0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}
